package com.sch.wanandroid.base

import android.os.Bundle

/**
 * Created by Sch.
 * Date: 2020/12/14
 * description:
 */
abstract class LazyFragment :BaseFragment(){
    private var isLoaded = false
    override fun onResume() {
        super.onResume()
        //增加了Fragment是否可见的判断
        if (!isLoaded && !isHidden) {
            lazyInit()
            isLoaded = true
        }
    }
    override fun onDestroyView() {
        super.onDestroyView()
        isLoaded = false
    }

    override fun init(savedInstanceState: Bundle?) {

    }
    abstract fun lazyInit()
}